import JsBridge from "./jsBridge"

window.callLocalApp = function(param,$el) {
  JsBridge.callHandler('callLocalApp', param, function responseCallback(res) {
    if(typeof res == "string")
      res = JSON.parse(res)
    if (res && res.nameSpace) {
      $el[res.nameSpace](res);
    }
  });
}
// 给 App 调用
// eslint-disable-next-line no-unused-vars
JsBridge.registerHandler('LocalAppTriggerEvent', function(data, responseCallback) {
  if(typeof data == "string")
    data = JSON.parse(data)
  if (data && data.func) {
    window[data.func](data);
  }
})